<?php


require('inc/function/confirm_manager.php');
require('inc/function/filter.php');
if(!(confirm_manager()==true && $cookie[0]==$web['manager'])){
  err('<img src="images/i.gif" /> 该命令必须以基本管理员'.$web['manager'].'身份登录！请重登录');
}
$_POST['ips']=trim($_POST['ips'])."\n";
$_POST['ips']=preg_replace("/[\r\n]+/","\n",$_POST['ips']);

if(!preg_match('/\d+\.\d+\.\d+\.(\d+|\-)/',$_POST['ips'])){
  err('请填有效的IP数据！格式为：*.*.*.*');
}
if(!preg_match("/^\d+\.\d+\.\d+\.(\d+|\-)\n$/m",$_POST['ips'])){
  err('请填有效的IP数据！只能数字、.、换行符、-填写。用回车键分开IP，即一行填一个IP');
}

$_POST['ips']=trim($_POST['ips']);
$arr=@explode("\n",$_POST['ips']);
$arr=array_unique($arr);
$arr=array_filter($arr);

require('inc/function/write_file.php');
@chmod('data',0777);
if(!file_exists('data/ip')){
  @mkdir('data/ip',0777);
}
foreach($arr as $v){
  if(preg_match('/^\d+\.\d+\.\d+\.(\d+|\-)$/',$v))
    write_file('data/ip/'.$v);
}
  
alert('<img src="images/ok.gif" /> IP屏蔽成功','admin_ip.php');


?>



